package com.qingke.oms.command.shop;

import java.util.List;

import com.qingke.oms.command.ShopCommand;
import com.qingke.oms.pojo.Goods;
import com.qingke.oms.pojo.GoodsRecord;
import com.qingke.oms.pojo.Shop;
import com.qingke.oms.pojo.User;
import com.qingke.oms.util.OMSConsole;

public class ViewGoodsCommand extends ShopCommand implements UpdateGoodsStatistic{

	public ViewGoodsCommand(User user, Shop shop) {
		super(user, shop);
	}

	@Override
	public void execute() {
		updateGoodsStatistic();
		List<GoodsRecord> list = dao.selectGoodsStatisticByShopId(shop.getId());
		OMSConsole.println("-------goods list-------");
		for(GoodsRecord gr:list){
			Goods goods=gr.getGoods();
			OMSConsole.print(goods);
			OMSConsole.println("      [Stock]:"+gr.getQuantity()+",[price]:"+gr.getPrice());
		}
	}

}
